@extends('home.layout.base')
@section('scripts')
    <script>
        $(function () {
            $('.download-btn').click(function(){
                let id = $(this).attr('data-id');
                @if (auth()->guest())
                    window.location.href = "{{ route('home.auth.login') }}";
                @else
                    window.location.href = "{{ route('home.college.download') }}"+'?id='+id;
                @endif

            })
        })
    </script>
@endsection
@section('content')
    <div class="container main">
        <div class="row">
            <div class="col-lg-12">
                <div class="college-info-detail">
                    <div class="col-lg-12 college-info-head">
                        <p class="college-info-crumb"><a href="">首页</a> > <a href="{{ route('home.college.index') }}">学院</a> > {{ $info['title'] }}</p>
                        <h4>{{ $info['title'] }}</h4>
                        <p class="college-info-other">
                            <span>{{ $info['created_at']->format('Y-m-d H:i') }}</span>
                            <span class="college-info-other-right">
                                <i class="fa fa-eye"></i> &nbsp;{{ $info['view'] }}
                                <i class="fa fa-download"></i> &nbsp;{{ $info['download'] }}
                            </span>
                        </p>
                    </div>
                    <div class="college-book">
                        <img src="{{ $info['thumb'] }}" alt="">
                        <div class="college-book-cont">
                            {!! $info['content'] !!}
                        </div>
                    </div>
                    <button class="download-btn" data-id="{{ $info['id'] }}"><i class="fa fa-download"></i> 下载文档</button>
                </div>
            </div>
        </div>
    </div>
@endsection

